from django.conf.urls.defaults import *
from artwerx.models import Artwork, Tag
#from gvollrath.artwerx.views import *

#RANDOM! RANDOM!
from random import *

info_dict_all = {
    'queryset': Artwork.objects.all(),
    'paginate_by': 40,
    'allow_empty': True,
}

# info_dict_index = {
    # 'template': 'index.html',
    # 'extra_context': {'year_index_list': range(2007,2000)},
# }

# info_dict_front = {
    # 'tag': Tag.objects.all()[0].name ,
# }

#if Tag.objects.all():
    #info_dict_front = {'tag': Tag.objects.all()[0].name, }
#else:
info_dict_front = {'tag': 'front', }

urlpatterns = patterns('',
    #(r'^$', 'gvollrath.artwerx.views.all'),
    #(r'^$', 'django.views.generic.simple.direct_to_template', info_dict_index),
    (r'^$', 'artwerx.views.artwork_frontPage', info_dict_front, 'index'),
    (r'^all/$', 'django.views.generic.list_detail.object_list', info_dict_all, 'all'),
    #(r'^(?P<year>\d+)/$', 'django.views.generic.list_detail.object_list', info_dict_all),
    (r'^(?P<year>\d{4})/$', 'artwerx.views.artwork_listByYear', info_dict_all, 'year_gallery'),
    (r'^(?P<year>\d{2})/$', 'artwerx.views.artwork_listByYear', info_dict_all, 'year_gallery'),
    (r'^artist/(?P<artist>.+)/$', 'artwerx.views.artwork_listByArtist', ),
    (r'^view/(?P<slug>.+)/$', 'artwerx.views.artwork_single', ),
    (r'^tag/(?P<tag>.+)/$', 'artwerx.views.artwork_listByTag', {}, 'tag_gallery'),
    (r'^ajax/(?P<year>\d{4})/$', 'artwerx.views.artwork_listByYear_ajax', ),
    (r'^ajax/(?P<year>\d{4}).json$', 'artwerx.views.artwork_listByYear_json', info_dict_all, 'year_gallery'),
    (r'^ajax/(?P<year>\d{4}).xml$', 'artwerx.views.artwork_listByYear_xml', info_dict_all, 'year_gallery'),
    (r'^ajax/(?P<slug>.+)/$', 'artwerx.views.artwork_single_snip', ),
    (r'^(?P<slug>.+)/$', 'artwerx.views.artwork_single', ),
)
